#ifndef MAINWINDOW_H
#define MAINWINDOW_H


#include <DMainWindow>
#include <DButtonBox>
#include <DGuiApplicationHelper>
#include "DataCenter.h"

DWIDGET_USE_NAMESPACE

class QScrollArea;
class TaskList;
class QVBoxLayout;
class StateBar;

class MainWindow : public DMainWindow
{
    Q_OBJECT

public:
    explicit MainWindow();
    virtual ~MainWindow() override;
    virtual bool event(QEvent *event) override;
    virtual void paintEvent(QPaintEvent *event) override;

private:
    DisplayInfo m_displayInfo = Home;
    QPoint movePoint;
    DButtonBox *box;
    DButtonBox *tools;
    QScrollArea *taskScrollArea;
    TaskList *taskList;
    StateBar *stateBar;
    QVBoxLayout *layout;
    DButtonBoxButton *homeButton;
    DButtonBoxButton *hiddenButton;
    DButtonBoxButton *createButton;
    static QColor backgroundColor;
    void initDateButtons();
    void initTaskList();
    void initToolButtons();

public slots:
    void refreshTaskList();
    void onDayButtonClicked(QAbstractButton *dayButton);

private slots:
    void onCreateButtonClicked();
    void onThemeChanged(DGuiApplicationHelper::ColorType type);

};

class DayButton : public DButtonBoxButton
{
    Q_OBJECT
public:
    DayButton(QString text, QWidget* parent) : DButtonBoxButton(text, parent)
    {
    }

    virtual bool event(QEvent *event) override;
};


#endif // MAINWINDOW_H
